BIN=proc.exe
CC=gcc
#SRC=$(shell ls *.c)
SRC=$(wildcard *.c)
OBJ=$(SRC:.c=.o)
LFLAGS=-o
FLAGS=-c
RM=rm -f

$(BIN):$(OBJ)
	@$(CC) $(LFLAGS) $@ $^
	@echo "linking ... $^ to $@"
%.o:%.c
	@$(CC) $(FLAGS) $<
	@echo "compling ... $< to $@"
.PHONY:clean
clean:
	$(RM) $(OBJ) $(BIN)

.PHONY:test
test:
	@echo $(SRC) 
	@echo $(OBJ)


























# BIN=proc.exe
# CC=gcc
# SRC=myproc.c
# FLAGS=-o
# RM=rm -f
# 
# 
# $(BIN):$(SRC)
# 	@$(CC) $(FLAGS) $@ $^
# 	@echo "linking ... $^ to $@"
# .PHONY:
# clean:
# 	@$(RM) $(BIN)
# 	@echo "remove ... $(BIN)"
# 
# .PHONY:test
# test:
# 	@echo $(BIN)
# 	@echo $(CC)
# 	@echo $(SRC)
# 	@echo $(FLAGS)
# 	@echo $(RM)



#myproc:myproc.o
#	gcc myproc.o -o myproc
#myproc.o:myproc.s
#	gcc myproc.s -o myproc.X
#myproc.s:myproc.i
#	gcc -S myproc.i -o myproc.s
#myproc.i:myproc.c
#	gcc -E myproc.c -o myproc.i
#
#.PHONY:clean
#clean:
#	rm -f *.i *.s *.o myproc

# myproc:myproc.c
# 	gcc -o myproc myproc.c
# 
# .PHONY:clean
# clean:
# 	rm -f myproc

